{% extends "package/base.html" %}

{% load crispy_forms_tags i18n page_metadata_tags %}

{% block metadata %}
    {% translate "Edit package example" as trans_title %}
    {% page_metadata page_title=trans_title %}
{% endblock metadata %}

{% block body %}

    <h2>{% translate "Edit package example" %}</h2>

    <form action="{{ request.path }}" method="post">
        {% csrf_token %}
        <fieldset>
            {{ form|crispy }}
            <div class="form_block">
                <input class="btn btn-default" type="submit" name="edit" value="{% translate "Edit" %}">
                <a href="{% url 'package' package_example.package.slug %}">{% translate "cancel" %}</a>
            </div>
        </fieldset>

    </form>
    {% if user.id == package_example.created_by.id %}
        <a class="btn btn-danger" name="delete" href="{% url 'delete_example' package_example.package.slug package_example.id %}" id="example-delete-btn">{% translate "Delete" %}</a>
    {% endif %}

{% endblock body %}

{% block extra_body %}
    <script>
        $("#id_title").focus();
    </script>
{% endblock extra_body %}
